$(document).ready(function(){
		$("#showFormSignin").click(function(){
			$("#changeToText").empty();
			$("#changeToText").append('<h1>Tạo tài khoản</h1>');
			  $(".formSignin").show( "slow" );
			});
	});

function fancyClose() { 
    jQuery("a.fancybox-close").trigger("click"); 
} 

function doSignin() {
	var signinEmail = $('#signinEmail').val();
	var signinPassword = $('#signinPassword').val();
	var signinName = $('#signinName').val();
	var dataString = {
			'email' : signinEmail,
			'password' : signinPassword,
			'memberNm' : signinName,
		};
		$.ajax({
			dataType : 'json',
			type : 'POST',
			url : 'doSignin',
			data : dataString,
			complete : function(data) {
				
				if(data.status == 200){
					var json = JSON.parse(data.responseText);
					 BootstrapDialog.alert('Hi Apple!', function(){
//						 parent.$.fancybox.close();
						 window.top.location.href =  'member?memberId=' + json.model.memberId; 
						 // window.top.location.href = 'member?memberId=' + json.model.memberId; 
				        });
					 
				}else{
					alert('dang ky that bai');
				}
				
				
			}

		});
		return false;
}

function doLogin() {
	var loginEmail = $('#loginEmail').val();
	var loginPassword = $('#loginPassword').val();
	var dataString = {
			'email' : loginEmail,
			'password' : loginPassword,
		};
		$.ajax({
			dataType : 'json',
			type : 'POST',
			url : 'doLogin',
			data : dataString,
			complete : function(data) {
				console.log(data);
				if(data.status == 200){
					window.top.location.reload();
					 
				}else{
					alert('dang nhap that bai');
				}
				
				
			}

		});
		return false;
}

